<?php

namespace App\Http\Controllers;

use App\Models\Project_info as Project_info;


use App\Http\Requests;
use App\Http\Controllers\Controller;

class ProController extends Controller
{

	
	#查看项目详细信息
    public function std_detail($pid){
    	$data=Project_info::find($pid);

    	return view('project/std_detail',['data'=>$data]);
    }

    public function thr_detail($pid){
        $data=Project_info::find($pid);

        return view('project/thr_detail',['data'=>$data]);
    }


    ######################文件下载######################################
    public function downloads($name){

        $file_dir = app_path().'\storage\uploads\\';    
         echo $file_dir;
        if (!file_exists($file_dir.$name)){
            header("Content-type: text/html; charset=utf-8");
            echo "File not found!";
            exit(); 
        } else {
            $file = fopen($file_dir.$name,"r"); 
            Header("Content-type: application/octet-stream");
            Header("Accept-Ranges: bytes");
            Header("Accept-Length: ".filesize($file_dir . $name));
            Header("Content-Disposition: attachment; filename=".$name);

            ob_clean();  
            flush();  
            readfile($file_dir.$name);  
        }
    }
}
